/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.model;

/**
 *
 * @author Mr.Sam
 */
import java.util.*;
import fr.ove.openmath.jome.model.*;
import fr.ove.openmath.jome.model.events.ModelEvent;

/**
*
* @author © 1999 DIRAT Laurent
* @version 2.0 28/06/1999
*/
public class Rational extends KaryOperator {
    /** 
    * Inserts the instance in the formula tree structure.<BR>
    * @param current the position in the formula tree where the operator is to be insert.
    * @return the new current position int hte formula tree.
    */
    public FormulaTreeStructure insert(FormulaTreeStructure current) {
        current = super.insert(current);
        super.addElement();
        return current;
    }
    
    /**
    * Adds a new element (template) to the end of the list.
    * Returns the new element.
    */
    public FormulaTreeStructure addElement() {
        FormulaTreeStructure denominator = (FormulaTreeStructure) getChild(1).getChild(0);
        
        if (denominator.isTemplate())
            return denominator;
        else
            return this;
    }
}

